/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ventasInternet.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author DESARO03
 */
@Entity
@Table(name = "comentario")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Comentario.findAll", query = "SELECT c FROM Comentario c"),
    @NamedQuery(name = "Comentario.findByIdcomenta", query = "SELECT c FROM Comentario c WHERE c.idcomenta = :idcomenta"),
    @NamedQuery(name = "Comentario.findByFecha", query = "SELECT c FROM Comentario c WHERE c.fecha = :fecha"),
    @NamedQuery(name = "Comentario.findByComentario", query = "SELECT c FROM Comentario c WHERE c.comentario = :comentario"),
    @NamedQuery(name = "Comentario.findByHora", query = "SELECT c FROM Comentario c WHERE c.hora = :hora"),
    @NamedQuery(name = "Comentario.findByUsuario", query = "SELECT c FROM Comentario c WHERE c.usuario = :usuario")})
public class Comentario implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idcomenta")
    private Integer idcomenta;
    @Column(name = "fecha")
    @Temporal(TemporalType.DATE)
    private Date fecha;
    @Size(max = 500)
    @Column(name = "comentario")
    private String comentario;
    @Column(name = "hora")
    @Temporal(TemporalType.TIME)
    private Date hora;
    @Size(max = 10)
    @Column(name = "usuario")
    private String usuario;
    @JoinColumn(name = "producto_idProd", referencedColumnName = "idProd")
    @ManyToOne(optional = false)
    private Producto productoidProd;

    public Comentario() {
    }

    public Comentario(Integer idcomenta) {
        this.idcomenta = idcomenta;
    }

    public Integer getIdcomenta() {
        return idcomenta;
    }

    public void setIdcomenta(Integer idcomenta) {
        this.idcomenta = idcomenta;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public String getComentario() {
        return comentario;
    }

    public void setComentario(String comentario) {
        this.comentario = comentario;
    }

    public Date getHora() {
        return hora;
    }

    public void setHora(Date hora) {
        this.hora = hora;
    }

    public String getUsuario() {
        return usuario;
    }

    public void setUsuario(String usuario) {
        this.usuario = usuario;
    }

    public Producto getProductoidProd() {
        return productoidProd;
    }

    public void setProductoidProd(Producto productoidProd) {
        this.productoidProd = productoidProd;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idcomenta != null ? idcomenta.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Comentario)) {
            return false;
        }
        Comentario other = (Comentario) object;
        if ((this.idcomenta == null && other.idcomenta != null) || (this.idcomenta != null && !this.idcomenta.equals(other.idcomenta))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ventasInternet.entity.Comentario[ idcomenta=" + idcomenta + " ]";
    }
    
}
